package com.ruoyi.web.controller.net;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.net.domain.BusiL2VpnTunnelStrategy;
import com.ruoyi.net.service.IBusiL2VpnTunnelStrategyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * L2_VPN 隧道策略Controller
 * 
 * @author tony
 * @date 2025-02-17
 */
@Api(tags = "L2_VPN 隧道策略")
@RestController
@RequestMapping("/busi/l2/vpn/tunnel/strategy")
public class BusiL2VpnTunnelStrategyController extends BaseController
{
    @Autowired
    private IBusiL2VpnTunnelStrategyService busiL2VpnTunnelStrategyService;

    /**
     * 查询L2_VPN 隧道策略列表
     */
    @ApiOperation(value = "查询L2_VPN 隧道策略列表", httpMethod = "GET")
//    @PreAuthorize("@ss.hasPermi('net:strategy:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusiL2VpnTunnelStrategy busiL2VpnTunnelStrategy)
    {
        startPage();
        List<BusiL2VpnTunnelStrategy> list = busiL2VpnTunnelStrategyService.selectBusiL2VpnTunnelStrategyList(busiL2VpnTunnelStrategy);
        return getDataTable(list);
    }

    /**
     * 导出L2_VPN 隧道策略列表
     */
    @ApiOperation(value = "导出L2_VPN 隧道策略列表", httpMethod = "POST")
//    @PreAuthorize("@ss.hasPermi('net:strategy:export')")
    @Log(title = "L2_VPN 隧道策略", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusiL2VpnTunnelStrategy busiL2VpnTunnelStrategy)
    {
        List<BusiL2VpnTunnelStrategy> list = busiL2VpnTunnelStrategyService.selectBusiL2VpnTunnelStrategyList(busiL2VpnTunnelStrategy);
        ExcelUtil<BusiL2VpnTunnelStrategy> util = new ExcelUtil<BusiL2VpnTunnelStrategy>(BusiL2VpnTunnelStrategy.class);
        util.exportExcel(response, list, "L2_VPN 隧道策略数据");
    }

    /**
     * 获取L2_VPN 隧道策略详细信息
     */
    @ApiOperation(value = "获取L2_VPN 隧道策略详细信息", httpMethod = "GET")
//    @PreAuthorize("@ss.hasPermi('net:strategy:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busiL2VpnTunnelStrategyService.selectBusiL2VpnTunnelStrategyById(id));
    }

    /**
     * 新增L2_VPN 隧道策略
     */
    @ApiOperation(value = "新增L2_VPN 隧道策略", httpMethod = "POST")
//    @PreAuthorize("@ss.hasPermi('net:strategy:add')")
    @Log(title = "L2_VPN 隧道策略", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusiL2VpnTunnelStrategy busiL2VpnTunnelStrategy)
    {
        return toAjax(busiL2VpnTunnelStrategyService.insertBusiL2VpnTunnelStrategy(busiL2VpnTunnelStrategy));
    }

    /**
     * 修改L2_VPN 隧道策略
     */
    @ApiOperation(value = "修改L2_VPN 隧道策略", httpMethod = "PUT")
//    @PreAuthorize("@ss.hasPermi('net:strategy:edit')")
    @Log(title = "L2_VPN 隧道策略", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusiL2VpnTunnelStrategy busiL2VpnTunnelStrategy)
    {
        return toAjax(busiL2VpnTunnelStrategyService.updateBusiL2VpnTunnelStrategy(busiL2VpnTunnelStrategy));
    }

    /**
     * 删除L2_VPN 隧道策略
     */
    @ApiOperation(value = "删除L2_VPN 隧道策略", httpMethod = "DELETE")
//    @PreAuthorize("@ss.hasPermi('net:strategy:remove')")
    @Log(title = "L2_VPN 隧道策略", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busiL2VpnTunnelStrategyService.deleteBusiL2VpnTunnelStrategyByIds(ids));
    }
}
